<%--
    Document   : index.jsp
    Created on : Jun 2, 2011, 10:32:15 PM
    Author     : Manuel
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>


    <head>
        <script type="text/javascript" src="script.js"></script>
        <link rel="stylesheet" type="text/css" href="styles.css">
        <title>OSSQuery Analysis</title>
    </head>


    <body>

	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
        <div id="page">
        <%@ include file="/WEB-INF/header.html" %>

            <div id="main">
                <c:choose>



                    <c:when test="${response.intermediate}">

                        <form action="RequestReceiver" method="GET">
                            <input type="hidden" name="code" value="${response.datacode}">
                            <input type="hidden" id="filter" name="filter" value="false">
                            <table class="subtitle"><tr><td>
                            <h2>Dataset refinement : ${response.request}</h2> </td><td>
                            <div class="smallmenu">
                                <c:if test="${response.intermediate}"><input class="submit" type="submit" value="Submit" name="gobutton"/> | </c:if>
                                <input class="submit" type="submit" value="Filter" name="gobutton" onclick="setfilter(true)" /> | <a class="smalllink" href="/">Print</a>
                            </div></td></tr></table>
                        <hr class="short"/>
                        <p id="analysis">${response.resultText}</p>

                        <c:set var = "nores" scope="page" value="0"/>
                        <c:forEach items="${response.results}" var="result">
                            <c:set var = "nores" scope="page" value="1"/>

                            <div class="result">
                                <img class="plot" src="${result.image}" alt="plot" />
                                            <table class="resulttable">
                                            <tr><td class="values">${result.line1}</td><td class="values">${result.line3}</td></tr>
                                            <tr><td class="values">${result.line2}</td><td class="values">${result.line4}</td></tr>

                                            <tr><td class="values">filter values below</td><td class="values"><input type="text" class="inputfield" size="6" name="min${result.title}" maxlength="6"/> </td></tr>
                                            <tr><td class="values">filter values above</td><td class="values"><input type="text" class="inputfield" size="6" name="max${result.title}" maxlength="6"/> </td></tr>
                                            
                                            </table>

                                            <hr class="short"/>
                            </div>
                        </c:forEach>
                            <c:if test="${nores < 1}">
                                <p id="error">
                                    No data has been found. <br/>The request is either too old or too restrictive.<br/>Please <a href="/">query the system again</a>.

                                </p>
                            </c:if>
                            <c:if test="${nores  > 0}">

                                <c:if test="${response.intermediate}"><input class="submit" type="submit" value="Submit" name="gobutton"/><p> | </p>
                                <input class="submit" type="submit" value="Filter" name="gobutton" onclick="setfilter(true)" /><p> | </p><a class="smalllink" href="/">Print</a>

                                </c:if>
                            </c:if>
                        </form>
                    </c:when>



                    <c:otherwise>
                        <h2>Analysis : ${response.request}</h2>
                        <hr class="long"/>
                        <p id="analysis">${response.resultText}</p>
                        <c:set var = "found" scope="page" value="no"/>
                        <c:forEach items="${response.results}" var="result">
                            <c:set var = "found" scope="page" value="yes"/>

                            <div class="result">
                                <img class="plot" src="${result.image}" alt="plot" />


                                    <c:choose>
                                        <c:when test="${result.correlation}">
                                            <table class="resulttable">
                                            <tr><td>Correlation (Pearson)</td><td>Regression (${result.regType})</td></tr>
                                            <tr><td class="values">${result.line3}</td><td class="values">${result.line1}</td></tr>
                                            <tr><td class="values">${result.line4}</td><td class="values">${result.line2}</td></tr>
                                            </table>
                                       </c:when>
                                        <c:otherwise>
                                            <br/><br/><br/>
                                       </c:otherwise>
                                   </c:choose>
                            </div>
                        </c:forEach>
                    </c:otherwise>



                </c:choose>

            </div>
        </div>
        <%@ include file="/WEB-INF/footer.html" %>
    </body>
</html>
